﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Panny.Data;
using System.ComponentModel;
namespace Model.Sys
{
   public class AreaData
   {
       #region prototype
       private int areaID;
        public int AreaID
        {
            get
            {
                return areaID;
            }
            set
            {
                if (this.areaID != value)
                    this.areaID = value;
            }
        }

        private string areaName;
        public string AreaName
        {
            get
            {
                return areaName;
            }
            set
            {
                if (this.areaName != value)
                    this.areaName = value;
            }
        }

        private string areaCode;
        public string AreaCode
        {
            get
            {
                return areaCode;
            }
            set
            {
                if (this.areaCode != value)
                    this.areaCode = value;
            }
        }

       #endregion

       public static string GetAreaNameByID(string cityid)
       {
           return "";
       }
       public static AreaData GetAreaNameByCode(string citycode)
       {
           string sql = "select AreaID,AreaName from Sys_Area where Code=@Code and deep=1";
            AreaData obj = new AreaData();
           using (SqlText selection = new SqlText(sql))
           {
               selection.AddParameter("@Code", citycode);
               while (selection.Read())
               {
                  
                   obj.AreaID =Convert.ToInt32(selection["AreaID"].ToString());
                   obj.AreaName = selection["AreaName"].ToString();
               }
           }
           return obj;
       }
    }
}
